package com.square.service.auth.provider.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.square.service.auth.provider.service.LoginService;
import com.square.service.common.entity.auth.vo.LoginParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 登录认证控制器
 *
 * @author : 王苏
 * @since : 2021/4/16 17:27
 */
@RestController
public class LoginController {

    @Resource
    private LoginService loginService;

    /**
     * 获取验证码
     *
     * @return
     */
    @GetMapping("/getvalidCode")
    public R<?> getvalidCode() {
        return loginService.getvalidCode();
    }

    /**
     * 登录
     *
     * @param loginParam
     * @return
     */
    @PostMapping("/login")
    public R<?> login(@RequestBody @Valid LoginParam loginParam) {
        return loginService.login(loginParam);
    }

}
